﻿using System.ComponentModel;
using System.Configuration;
using System.IO;
using System.Windows.Input;

using Buddy.XmlEngine;
using Buddy.Swtor;
using Buddy.Common.Xml;

namespace EquipMe.Settings
{
    [XmlElement("EquipMeSettings")]
    public class EquipMeSettings : XmlSettings
    {
        public EquipMeSettings Settings
        {
            get { return EquipMeSettings.Instance; }
        }

        #region Singleton
        private static EquipMeSettings _instance;

        public EquipMeSettings()
            : base(Path.Combine(Path.Combine(SettingsDirectory, BuddyTor.Me.Name), "EquipMeSettings.xml"))
        {

        }

        public static EquipMeSettings Instance
        {
            get { return _instance ?? (_instance = new EquipMeSettings()); }
        }
        #endregion

        #region Fields
        private bool _EnableAutoEquip;
        private bool _EnableRepItems;
        private bool _EnableLockboxes;

        private float _StatMain;
        private float _StatTechForce;
        private float _StatEndurance;
        private float _StatAccuracy;
        private float _StatAlacrity;
        private float _StatArmor;
        private float _StatCritChance;
        private float _StatDamage;
        private float _StatDefense;
        private float _StatGlance;
        private float _StatPower;
        private float _StatExpertise;
        private float _StatSurge;
        #endregion

        #region Elements
        [XmlElement("EnableAutoEquip")]
        [Setting]
        [DefaultValue(true)]
        public bool EnableAutoEquip
        {
            get { return _EnableAutoEquip; }
            set
            {
                if (_EnableAutoEquip == value)
                    return;
                _EnableAutoEquip = value;
            }
        }

        [XmlElement("EnableRepItems")]
        [Setting]
        [DefaultValue(true)]
        public bool EnableRepItems
        {
            get { return _EnableRepItems; }
            set
            {
                if (_EnableRepItems == value)
                    return;
                _EnableRepItems = value;
            }
        }

        [XmlElement("EnableLockboxes")]
        [Setting]
        [DefaultValue(true)]
        public bool EnableLockboxes
        {
            get { return _EnableLockboxes; }
            set
            {
                if (_EnableLockboxes == value)
                    return;
                _EnableLockboxes = value;
            }
        }

        [XmlElement("StatMain")]
        [Setting]
        [DefaultValue(10)]
        public float StatMain
        {
            get { return _StatMain; }
            set
            {
                if (_StatMain != value)
                {
                    _StatMain = value;
                }
            }
        }

        [XmlElement("StatTechForce")]
        [Setting]
        [DefaultValue(3)]
        public float StatTechForce
        {
            get { return _StatTechForce; }
            set
            {
                if (_StatTechForce != value)
                {
                    _StatTechForce = value;
                }
            }
        }

        [XmlElement("StatEndurance")]
        [Setting]
        [DefaultValue(8)]
        public float StatEndurance
        {
            get { return _StatEndurance; }
            set
            {
                if (_StatEndurance != value)
                {
                    _StatEndurance = value;
                }
            }
        }

        [XmlElement("StatAccuracy")]
        [Setting]
        [DefaultValue(3)]
        public float StatAccuracy
        {
            get { return _StatAccuracy; }
            set
            {
                if (_StatAccuracy != value)
                {
                    _StatAccuracy = value;
                }
            }
        }

        [XmlElement("StatAlacrity")]
        [Setting]
        [DefaultValue(0)]
        public float StatAlacrity
        {
            get { return _StatAlacrity; }
            set
            {
                if (_StatAlacrity != value)
                {
                    _StatAlacrity = value;
                }
            }
        }

        [XmlElement("StatArmor")]
        [Setting]
        [DefaultValue(10)]
        public float StatArmor
        {
            get { return _StatArmor; }
            set
            {
                if (_StatArmor != value)
                {
                    _StatArmor = value;
                }
            }
        }

        [XmlElement("StatCritChance")]
        [Setting]
        [DefaultValue(3)]
        public float StatCritChance
        {
            get { return _StatCritChance; }
            set
            {
                if (_StatCritChance != value)
                {
                    _StatCritChance = value;
                }
            }
        }

        [XmlElement("StatDamage")]
        [Setting]
        [DefaultValue(5)]
        public float StatDamage
        {
            get { return _StatDamage; }
            set
            {
                if (_StatDamage != value)
                {
                    _StatDamage = value;
                }
            }
        }

        [XmlElement("StatDefense")]
        [Setting]
        [DefaultValue(0)]
        public float StatDefense
        {
            get { return _StatDefense; }
            set
            {
                if (_StatDefense != value)
                {
                    _StatDefense = value;
                }
            }
        }

        [XmlElement("StatGlance")]
        [Setting]
        [DefaultValue(0)]
        public float StatGlance
        {
            get { return _StatGlance; }
            set
            {
                if (_StatGlance != value)
                {
                    _StatGlance = value;
                }
            }
        }

        [XmlElement("StatPower")]
        [Setting]
        [DefaultValue(3)]
        public float StatPower
        {
            get { return _StatPower; }
            set
            {
                if (_StatPower != value)
                {
                    _StatPower = value;
                }
            }
        }

        [XmlElement("StatExpertise")]
        [Setting]
        [DefaultValue(0)]
        public float StatExpertise
        {
            get { return _StatExpertise; }
            set
            {
                if (_StatExpertise != value)
                {
                    _StatExpertise = value;
                }
            }
        }

        [XmlElement("StatSurge")]
        [Setting]
        [DefaultValue(3)]
        public float StatSurge
        {
            get { return _StatSurge; }
            set
            {
                if (_StatSurge != value)
                {
                    _StatSurge = value;
                }
            }
        }
        #endregion
    }
}
